/**
 * jQuery Data Processing Tip Plugin
 * This jQuery plugin could display loading tip div.
 * 
 * This plugin needs at least jQuery 1.4.2
 * The recommended jQuery1.7.2, because the plug-in is based on the 1.7.2 development
 */

(function($) {
    // Extend jQuery
    $.loading = function(flag) {   
		var _id = "dataProcessingTipId";       

		// Show Loading
		function show() {
			var tmpH = document.body.clientHeight;
			var _code = "<div id=\"" + _id + "\">";
			_code += "<div style=\"display:block; width: 100%; height:100%; z-index: 9998;\" class=\"datagrid-mask\"></div>";
			_code += "<div style=\"display:block; left: 50%; margin-left: -85.5px; color: #000000; font-size: 12px; z-index: 9999;\" class=\"datagrid-mask-msg\">正在处理，请稍待……</div>";
			_code += "</div>";
			$(_code).appendTo("body");
		}

		// Hidden Loading
		function hide() {
			$("#" + _id).remove();
		}
		
		// Invoke Method
        if (true == flag) {
			show();
		}
		else {
			hide();
		}
    }
})(jQuery);

